import { createRouter, createWebHistory } from "vue-router";
//创建一个路由数组
const routes = [{
    name: "main",
    path: "/main",
    component: () => import("@/components/Index.vue"),
    children: [{
        name: "home",
        path: "/main/home",
        component: () => import("@/components/Home.vue")
    }, {
        name: "allServices",
        path: "/main/services",
        component: () => import("@/components/AllServices.vue"),
    }, {
        name: "order",
        path: "/main/order",
        component: () => import("@/components/Order.vue"),
    }, {
        name: "user",
        path: "/main/user",
        component: () => import("@/components/User.vue"),
    }]
}, {
    name: "index",
    path: "",
    redirect: "/main"
},{
    name: "login",
    path: "/login",
    component: () => import("@/components/Login.vue")
},{
    name: "register",
    path: "/register",
    component: () => import("@/components/Home.vue")
}, {
    name: "Test",
    path: "/test",
    component: () => import("@/components/ground/Test.vue")
} ,{
    name: "createorder",
    path: "/home/createorder",
    component: () => import("@/components/Createorder.vue")
}
];

//创建一个路由器，路由转发器
const router = createRouter({
    routes,
    history: createWebHistory()
});

export default router;